package com.bitejiuyeke.job_publish.service;

import com.bitejiuyeke.job_publish.common.PageResult;
import com.bitejiuyeke.job_publish.model.FavoriteRecord;
import org.springframework.transaction.annotation.Transactional;

public interface IFavoriteRecordService {

    /**
     * 用户增加收藏
     * @param record
     */
    @Transactional
    void create (FavoriteRecord record);

    /**
     * 用户取消收藏
     * @param id 收藏记录Id
     * @param userId 用户Id
     */
    @Transactional
    void deleteById (Long id, Long userId);

    /**
     * 根据用户Id和职位Id查询未被删除的记录
     * @param userId 用户Id
     * @param jobId 职位Id
     * @return FavoriteRecord
     */
    FavoriteRecord selectNormalByUserIdAndJobId(Long userId, Long jobId);

    /**
     * 投递者查询收藏总数
     * @param record
     * @return
     */
    int selectTotalByUser(FavoriteRecord record);

    /**
     * 投递者查询收藏分页列表
     * @param record
     * @return
     */
    PageResult<FavoriteRecord> selectPageByUser (FavoriteRecord record);

    // 发布者查询收藏列表，关联User
}
